package com.oss.Intercept;

import java.sql.Timestamp;
import java.util.Date;

// import org.joda.time.DateTime;
import com.eova.aop.AopContext;
import com.eova.aop.MetaObjectIntercept;
import com.eova.common.utils.xx;
/*
import com.eova.config.EovaConst;
import com.eova.model.User;
import com.jfinal.core.Controller;
*/

public class aj_jydw extends MetaObjectIntercept {
	public String tableName = "aj_jydw";
	public String className = "com.oss.Intercept." + tableName;
	
	@Override
	 
	public void queryBefore(AopContext ac) throws Exception {
		// DIY 查询，名称有值，用名称里面的值来查状态列
		InterceptUtil.queryBefore(ac, className, tableName);
	}

	
	public String updateBefore(AopContext ac) throws Exception {
		String method = "updateBefore";
		System.out.println(className + "." + method + "> start ...");
		String user_id = InterceptUtil.getUserID(ac);

		ac.record.set("updateowner", user_id);
		ac.record.set("updatetime", new Timestamp(new Date().getTime()));
		System.out.println(className + "." + method + "> end.");
		return super.updateBefore(ac);
	}

	public String addBefore(AopContext ac) throws Exception {
		String method = "addBefore";
		System.out.println(className + "." + method + "> start ...");
		String user_id = InterceptUtil.getUserID(ac);
		String xid = InterceptUtil.getXID(ac);
		ac.record.set("pid", user_id);
		ac.record.set("gid", xid);
		ac.record.set("insertowner", user_id);
		ac.record.set("inserttime", new Timestamp(new Date().getTime()));
		System.out.println(className + "." + method + "> end.");
		return super.addBefore(ac);
	}	
	
}
